package com.yqg.education.mapper;

import com.yqg.education.controller.dto.TrainClassDTO;
import com.yqg.education.entity.ExamSign;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.MapKey;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;


import java.util.List;
import java.util.Map;

/**
 * <p>
 *  Mapper 接口
 * </p>
 *
 * @author 张芸博
 * @since 2025-04-10
 */
@Mapper
public interface ExamSignMapper extends BaseMapper<ExamSign> {

    Long getExampaperIdByStuIdAndCourseId(@Param("userId") Long userId,
                                             @Param("courseId") Long courseId);

    Long saveExampaperIdByUserIdAndCourseId(@Param("userId") Long userId,
                                            @Param("courseId") Long courseId,
                                            @Param("exampaperId") Long exampaperId);

    List<ExamSign> pageList(@Param("pageNum") Integer pageNum, @Param("pageSize") Integer pageSize, String username, String courseName, String examName);
    Long findCount(String username, String courseName, String examName);

    List<ExamSign> stuPageList(@Param("pageNum") Integer pageNum, @Param("pageSize") Integer pageSize , @Param("search") String search, @Param("stuId") Integer stuId);
    Long stuFindCount(@Param("search") String search, @Param("stuId") Integer stuId);

    /**
     *  根据classID获取本班级对应课程的考试签到率
     * @param classId 课程ID
     * @return map（courseId（课程Id），courseName（课程名称）,actualSign（实际签到人数）,requiredSign（应该签到人数））组成的list集合
     */
    @MapKey("courseId")
    List<Map<String, Object>> getExamSignRate(@Param("classId") Long classId);
}
